const { exec } = require('../db')

const router = require('koa-router')()

router.post('/login', async (ctx, next) => {
  let {username,password}=ctx.request.body
  let loginSql=`SELECT * FROM userlist WHERE username='${username}' AND password='${password}'`
  const data=await exec(loginSql)
  if(data.length>0){
    ctx.body={
      code:200,
      message:'登陆成功'
    }
  }else{
    ctx.body={
      code:403,
      message:'登录失败'
    }
  }
})



module.exports = router
